package com.monitoring.domain.entity;

import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "air_conditioners")
public class AirConditioner extends Device {
    private int temperature;
    private String mode; // 制冷、制热、送风等
    private int fanSpeed;
    private boolean energySavingMode;
    
    // 空调特有的领域方法
    public void setTemperature(int temperature) {
        if (temperature >= 16 && temperature <= 30) { // 温度范围限制
            this.temperature = temperature;
        }
    }
    
    public void toggleEnergySavingMode() {
        this.energySavingMode = !this.energySavingMode;
    }
    
    public void setFanSpeed(int fanSpeed) {
        if (fanSpeed >= 1 && fanSpeed <= 5) { // 风速范围限制
            this.fanSpeed = fanSpeed;
        }
    }
}